<% if programs.nil? or programs.size.zero? %>
	<div class="span-16 bordered centered last">There are no Programs to show.</div>
<% else %>
	<script language="javascript" type="text/javascript" src="javascripts/site.js"></script>

	<%= title unless (defined? title).nil? %>
	<div class="span-18 list_header last">
		<div class="span-6 description bold">Name</div>
		<div class="span-6 description bold">Short Description</div>
		<div class="span-2 description bold">Created at</div>
		<div class="span-3 description bold"># Broadcasts</div>
	</div>
	<% programs.each do |program| -%>
		<div class="span-18 <%= cycle('odd', 'even') %> last">
			<div class="span-6 description left">
				<%= link_to_function("<span id='#{program.id}_arrow'>" + image_tag('toggle_right.png') + '</span>', 
					"Effect.toggle('#{program.id}_broadcasts_div', 'appear'); change_arrow('#{program.id}_arrow', 'Broadcasts'); return false;",
					 :title => 'Show Broadcasts', :class => 'non_underline') unless program.broadcasts.blank? %>
				<%= link_to "#{program.name}", :controller => 'programs', :action => 'show', :id => program %>
			</div>
			<div class="span-6 description"><%= "#{program.short_description}" %></div>
			<div class="span-2 description"><%= "#{program.created_at.to_date}" %></div>
			<div class="span-3 description"><%= "#{program.broadcasts.size}" %></div>
		</div>
		
		<div id='<%= "#{program.id}_broadcasts_div" %>' style="display: none;">
			<%= render :partial => 'broadcasts/second_level_list', :locals => { :broadcasts => program.broadcasts } %>
		</div>
	<% end -%>
<% end %>